import { functionCommon, requestCommon } from "@whzhuke/common"

export default {
  list: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role`,
      params
    })
  },
  item: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role/${params.id}`
    })
  },
  add: (params: any) => {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role`,
      params
    })
  },
  del: (params: any) => {
    return requestCommon.del<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role/${params.id}`
    })
  },
  edit: (params: any) => {
    return requestCommon.put<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role`,
      params
    })
  },
  distributePermissions: (params: any) => {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role/permissions`,
      params
    })
  },
  queryHavePermissions: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/role/${params.id}/permissions`
    })
  },
  itemConfigSet(params: any) {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/menu`,
      params
    })
  },
  itemConfigList(params: any) {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/admin/rules/itemConfigList`,
      params
    })
  }
}
